<?php
$total = 0;
 
foreach ($this->rel as $key => $val)
{
	$total += $val["caf05_valor"];
}


?>

<script>

$(function(){


<?php 
for($i =0; $i < sizeof($this->rel); $i++)
{
?>
		
		$.post("pedido/list", {cod: <?php echo $this->rel[$i]["caf02_cod"]; ?>}, function(res){
			$("#list_all").append("<div class='ui-corner-all' style='background: #EFEFEF; margin-bottom: 10px; padding: 5px; border: 1px solid #DFDFDF;'>" + res + "</div>");
			$(".labelUser").hide();
		});
<?php 
}
?>
	
	//$("#list_all")
});


</script>

<div style="text-align: left;">

<table style="text-align: left;">
	<tr>
		<td>
			Nome
		</td>
		<td>
			:
		</td>
		<td>
			<strong><?php echo $this->rel[0]["caf01_user"]; ?></strong>
		</td>
		<td>
			Data Inicio
		</td>
		<td>
			:
		</td>
		<td>
			<strong><?php echo $this->rel[0]["caf01_user"]; ?></strong>
		</td>
	</tr>
	<tr>
		<td>
			Total Vendas
		</td>
		<td>
			:
		</td>
		<td>
			<strong><?php echo $total; ?></strong>
		</td>
		<td>
			Data Fim
		</td>
		<td>
			:
		</td>
		<td>
			<strong><?php echo $total; ?></strong>
		</td>
	</tr>
</table>

<hr style="margin: 10px 0 10px 0;" />

<a href="javascript:;" onclick="$('#list_all').slideDown();">Abrir Pedidos</a>

<div>
	
</div>

<div id="list_all" style="text-align: left; height: 400px; overflow: auto; position: relative; display: none;">

</div>

<table style="text-align: left; display: none;">
		<?php 
		foreach ($this->rel as $key => $val)
		{
		?>
	<tr>
		<td>
			<?php echo $val["caf05_prod"]; ?>(<?php echo $val["caf05_car"]; ?>)
		</td>
		<td>
			<?php echo $this->rel[0]["caf01_user"]; ?>
		</td>
		<td>
			<?php echo $val["caf05_prod"]; ?>
		</td>
	</tr>
		<?php
		}
		?>
</table>

</div>
